<template>
  <div class="author-container pointer">
    <nuxt-link tag="div" :to="`/user/dabord/${blogUser.uid}`" class="author-detail flex-middle">
      <div class="author-pic user-pic flex-center">
        <img v-if="blogUser.portrait" :src="blogUser.portrait" alt="author pic" />
        <span v-else class="iconfont icon-touxiang"></span>
      </div>
      <div class="author-name-signature">
        <div class="name">{{blogUser.username}}</div>
        <div class="signature ellipsis">{{blogUser.information || '暂无签名'}}</div>
      </div>
    </nuxt-link>
  </div>
</template>

<script>
export default {
  props: {
    blogUser: {
      type: Object,
      required: true,
      default() {
        return {}
      }
    }
  },
  computed: {
    userPic() {
      return this.blogUser.portrait ? this.blogUser.portrait : require('@/static/images/icon/logo.svg')
    }
  }
}
</script>

<style lang="scss" scoped>
.author-container {
  padding: 10px 20px;
  background-color: #fff;

  .author-pic {
    --width: 50px;
    width: var(--width);
    min-width: var(--width);
    height: var(--width);
    overflow: hidden;
    margin: 5px 0;

    .iconfont {
      font-size: 20px;
    }
  }

  .author-name-signature {
    margin-left: 10px;
    overflow: hidden;

    .name {
      font-size: 18px;
    }
  }
}
</style>